package com.wm.ossService.controller;

import com.wm.commonutils.R;
import com.wm.ossService.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author: sshdg
 * @Date: 2020/9/28 22:39
 */
@RestController
@RequestMapping("/eduOss/fileOss")
//@CrossOrigin
public class OssController {

    @Autowired
    OssService ossService;
    //上传头像的方法
    @PostMapping("/uploadFile")
    public R uploadOssFile(MultipartFile file){
        String url = ossService.uploadFileAvatar(file);
        return R.ok().data("url", url);
    }
}
